import request from '@/utils/request';

export async function query(payload: object) {
  const data = await new Promise((resolve, reject) => {
    request('/api/report/chart', {
      params: { ...payload },
    })
      .then(response => {
        resolve(response);
      })
      .catch(error => {
        reject(error);
      });
  });
  return data;
}
export async function getChart(url: string, payload: object) {
  const data = await new Promise((resolve, reject) => {
    request(`/api/report/chart/${url}`, {
      method: 'POST',
      data: { ...payload },
    })
      .then(response => {
        resolve(response);
      })
      .catch(error => {
        reject(error);
      });
  });
  return data;
}
